﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_SoCaiChiTietTaiKhoan : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdExel")]
        private Button _CmdExel;
        [AccessedThroughProperty("CmdPrint")]
        private Button _CmdPrint;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        public DataTable pData;
        public string pLoai;

        public Frm_SoCaiChiTietTaiKhoan()
        {
            base.Resize += new EventHandler(this.Frm_SoCaiChiTietTaiKhoan_Resize);
            base.Load += new EventHandler(this.Frm_SoCaiChiTietTaiKhoan_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.pLoai = "SC";
            this.InitializeComponent();
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            if (this.pLoai == "SC")
            {
                this.PrintReport();
            }
            else
            {
                this.PrintReportSoChiTiet();
            }
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Frm_SoCaiChiTietTaiKhoan_Load(object sender, EventArgs e)
        {
            if (this.pData == null)
            {
                this.Dispose();
            }
            else
            {
                this.LoadData();
            }
        }

        private void Frm_SoCaiChiTietTaiKhoan_Resize(object sender, EventArgs e)
        {
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Cols[4].Width = vSlist.Width - ((((((vSlist.Cols[0].Width + vSlist.Cols[2].Width) + vSlist.Cols[3].Width) + vSlist.Cols[5].Width) + vSlist.Cols[6].Width) + vSlist.Cols[7].Width) + SystemInformation.VerticalScrollBarWidth);
            vSlist = null;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_SoCaiChiTietTaiKhoan));
            this.Panel1 = new Panel();
            this.Label2 = new Label();
            this.Label1 = new Label();
            this.Panel2 = new Panel();
            this.CmdExel = new Button();
            this.CmdPrint = new Button();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1.SuspendLayout();
            this.Panel2.SuspendLayout();
            this.VSlist.BeginInit();
            this.SuspendLayout();
            this.Panel1.BackColor = Color.White;
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.Panel2);
            this.Panel1.Dock = DockStyle.Top;
            Point point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x37e, 0x25);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0;
            this.Label2.AutoSize = true;
            this.Label2.Font = new Font("Microsoft Sans Serif", 11f, FontStyle.Bold, GraphicsUnit.Point, 0xa3);
            this.Label2.ForeColor = Color.MidnightBlue;
            point = new Point(0xd9, 11);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x39, 0x12);
            this.Label2.Size = size;
            this.Label2.TabIndex = 2;
            this.Label2.Text = "Label2";
            this.Label1.AutoSize = true;
            this.Label1.Font = new Font("Microsoft Sans Serif", 14f, FontStyle.Bold, GraphicsUnit.Point, 0xa3);
            this.Label1.ForeColor = Color.MidnightBlue;
            point = new Point(3, 7);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(210, 0x18);
            this.Label1.Size = size;
            this.Label1.TabIndex = 1;
            this.Label1.Text = "CHI TIẾT PH\x00c1T SINH";
            this.Panel2.Controls.Add(this.CmdExel);
            this.Panel2.Controls.Add(this.CmdPrint);
            this.Panel2.Dock = DockStyle.Right;
            point = new Point(0x27a, 0);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(260, 0x25);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0;
            point = new Point(0xb3, 7);
            this.CmdExel.Location = point;
            this.CmdExel.Name = "CmdExel";
            size = new Size(0x4c, 0x18);
            this.CmdExel.Size = size;
            this.CmdExel.TabIndex = 3;
            this.CmdExel.Text = "&Excel";
            this.CmdExel.UseVisualStyleBackColor = true;
            point = new Point(0x61, 7);
            this.CmdPrint.Location = point;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x4c, 0x18);
            this.CmdPrint.Size = size;
            this.CmdPrint.TabIndex = 2;
            this.CmdPrint.Text = "&In";
            this.CmdPrint.UseVisualStyleBackColor = true;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.XpThemes;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            point = new Point(0, 0x25);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            size = new Size(0x37e, 0x21a);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 8;
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x37e, 0x23f);
            this.ClientSize = size;
            this.Controls.Add(this.VSlist);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_SoCaiChiTietTaiKhoan";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "SO CAI CHI TIET TAI KHOAN";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.Panel2.ResumeLayout(false);
            this.VSlist.EndInit();
            this.ResumeLayout(false);
        }

        public void LoadData()
        {
            string str = "";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Tree.Column = 0;
            this.VSlist.Tree.Style = TreeStyleFlags.SimpleLeaf;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.pData.Rows.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                if (str.Trim() != this.pData.Rows[i]["SoTaiKhoan"].ToString().Trim())
                {
                    vSlist.Rows.InsertNode(vSlist.Rows.Count, 1);
                    str = this.pData.Rows[i]["SoTaiKhoan"].ToString().Trim();
                    vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoTaiKhoan"]);
                    vSlist[vSlist.Rows.Count - 1, 4] = modGeneral.Tranlated("Số dư đầu kỳ", "");
                    vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoDuNoDauKy"]);
                    vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoDuCoDauKy"]);
                    CellStyle style = vSlist.Styles["Red"];
                    if (style == null)
                    {
                        style = vSlist.Styles.Add("Red");
                        style.BackColor = Color.DarkSeaGreen;
                        style.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None;
                        style.Font = new Font(this.Font, FontStyle.Bold);
                    }
                    //vSlist.GetCellRange(vSlist.Rows.Count - 1, 0, vSlist.Rows.Count - 1, vSlist.Cols.Count - 1).Style = style;
                    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoChungTu"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
                    {
                        vSlist.Rows.InsertNode(vSlist.Rows.Count, 2);
                        vSlist[vSlist.Rows.Count - 1, 0] = "";
                        vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["KhoaChungTu"]);
                        vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoChungTu"]);
                        vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["NgayChungTu"]);
                        vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["DienGiai"]);
                        vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["TaiKhoanDoi"]);
                        vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoPhatSinhNo"]);
                        vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoPhatSinhCo"]);
                    }
                }
                else
                {
                    vSlist.Rows.InsertNode(vSlist.Rows.Count, 2);
                    vSlist[vSlist.Rows.Count - 1, 0] = "";
                    vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["KhoaChungTu"]);
                    vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoChungTu"]);
                    vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["NgayChungTu"]);
                    vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["DienGiai"]);
                    vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["TaiKhoanDoi"]);
                    vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoPhatSinhNo"]);
                    vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(this.pData.Rows[i]["SoPhatSinhCo"]);
                }
            }
            vSlist = null;
            this.VSlist.Styles.Alternate.BackColor = ProfessionalColors.ToolStripGradientMiddle;
        }

        public void PrintReport()
        {
            if (this.pData != null)
            {
                if (this.pData.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
                }
                else
                {
                    Rpt_SoCaiChiTiet tiet = new Rpt_SoCaiChiTiet();
                    try
                    {
                        tiet.SetDataSource(this.pData);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        tiet.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        tiet.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        tiet.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        tiet.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        tiet.SetParameterValue(5, modGeneral.Tranlated("SỔ C\x00c1I CHI TIẾT", ""));
                        tiet.SetParameterValue(6, modGeneral.Tranlated("", "") + this.Label2.Text);
                        tiet.SetParameterValue(7, modGeneral.Tranlated("T\x00ean t\x00e0i khoản", ""));
                        tiet.SetParameterValue(8, modGeneral.Tranlated("Số dư đầu kỳ", ""));
                        tiet.SetParameterValue(9, modGeneral.Tranlated("Số dư cuối kỳ", ""));
                        tiet.SetParameterValue(10, modGeneral.Tranlated("Tổng cộng", ""));
                        tiet.SetParameterValue(11, modGeneral.Tranlated("Số chứng từ", ""));
                        tiet.SetParameterValue(12, modGeneral.Tranlated("Ng\x00e0y", ""));
                        tiet.SetParameterValue(13, modGeneral.Tranlated("Diễn giải", ""));
                        tiet.SetParameterValue(14, modGeneral.Tranlated("TK đối", ""));
                        tiet.SetParameterValue(15, modGeneral.Tranlated("Ph\x00e1t sinh nợ ", ""));
                        tiet.SetParameterValue(0x10, modGeneral.Tranlated("Ph\x00e1t sinh c\x00f3", ""));
                        tiet.SetParameterValue(0x11, modGeneral.Tranlated("Lập biểu", ""));
                        tiet.SetParameterValue(0x12, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                        tiet.SetParameterValue(0x13, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                        tiet.SetParameterValue(20, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = tiet;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                        if (Form.ActiveForm != null)
                        {
                            Form.ActiveForm.Cursor = Cursors.Default;
                        }
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        if (Form.ActiveForm != null)
                        {
                            Form.ActiveForm.Cursor = Cursors.Default;
                        }
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        public void PrintReportSoChiTiet()
        {
            if (this.pData != null)
            {
                if (this.pData.Rows.Count == 0)
                {
                    LVYModule.ShowWarning(modGeneral.Tranlated("Kh\x00f4ng c\x00f3 dữ liệu !", ""));
                }
                else
                {
                    Rpt_SoCaiChiTiet tiet = new Rpt_SoCaiChiTiet();
                    try
                    {
                        tiet.SetDataSource(this.pData);
                        if (modGeneral.H_LANGUAGE == "VIET")
                        {
                            tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEVIET, ""));
                        }
                        else
                        {
                            tiet.SetParameterValue(0, modGeneral.Tranlated(modGeneral.H_COMPANYNAMEANH, ""));
                        }
                        tiet.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                        tiet.SetParameterValue(2, modGeneral.Tranlated("M\x00e3 số thuế", "") + ": " + modGeneral.H_TAXCODE);
                        tiet.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                        tiet.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                        tiet.SetParameterValue(5, modGeneral.Tranlated("SỔ CHI TIẾT T\x00c0I KHOẢN", ""));
                        tiet.SetParameterValue(6, modGeneral.Tranlated("", "") + this.Label2.Text);
                        tiet.SetParameterValue(7, modGeneral.Tranlated("T\x00ean t\x00e0i khoản", ""));
                        tiet.SetParameterValue(8, modGeneral.Tranlated("Số dư đầu kỳ", ""));
                        tiet.SetParameterValue(9, modGeneral.Tranlated("Số dư cuối kỳ", ""));
                        tiet.SetParameterValue(10, modGeneral.Tranlated("Tổng cộng", ""));
                        tiet.SetParameterValue(11, modGeneral.Tranlated("Số chứng từ", ""));
                        tiet.SetParameterValue(12, modGeneral.Tranlated("Ng\x00e0y", ""));
                        tiet.SetParameterValue(13, modGeneral.Tranlated("Diễn giải", ""));
                        tiet.SetParameterValue(14, modGeneral.Tranlated("TK đối", ""));
                        tiet.SetParameterValue(15, modGeneral.Tranlated("Ph\x00e1t sinh nợ ", ""));
                        tiet.SetParameterValue(0x10, modGeneral.Tranlated("Ph\x00e1t sinh c\x00f3", ""));
                        tiet.SetParameterValue(0x11, modGeneral.Tranlated("Lập biểu", ""));
                        tiet.SetParameterValue(0x12, modGeneral.Tranlated("Kế to\x00e1n trưởng", ""));
                        tiet.SetParameterValue(0x13, modGeneral.Tranlated("Gi\x00e1m đốc", ""));
                        tiet.SetParameterValue(20, modGeneral.Tranlated("Ng\x00e0y .... th\x00e1ng .... năm ............", ""));
                        MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = tiet;
                        MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                        MyProject.Forms.Frm_ViewReport.ShowDialog();
                        if (Form.ActiveForm != null)
                        {
                            Form.ActiveForm.Cursor = Cursors.Default;
                        }
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        if (Form.ActiveForm != null)
                        {
                            Form.ActiveForm.Cursor = Cursors.Default;
                        }
                        MessageBox.Show(exception.Message.ToString());
                        ProjectData.ClearProjectError();
                    }
                }
            }
        }

        internal virtual Button CmdExel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdExel = value;
            }
        }

        internal virtual Button CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

